/*
 * CommunicationService.h
 *
 */

#ifndef COMMUNICATIONSERVICE_H_
#define COMMUNICATIONSERVICE_H_

#include "MessageQueue2.h"

namespace Middleware{

template <typename T>
class IPCCommunicationService
{
public:

	IPCCommunicationService(std::string key);

	virtual ~IPCCommunicationService();

	virtual void create();

	virtual void destroy();

	virtual void connect();

	virtual void disconnect();

	virtual void send(MessageId_t id,T data);

	virtual T recv(MessageId_t id);
private:
	MessageQueue2<T>   m_queue;
};

template <typename T>
IPCCommunicationService<T>::IPCCommunicationService(std::string key)
:m_queue(key,'a')
{

}

template <typename T>
IPCCommunicationService<T>::~IPCCommunicationService()
{

}

template <typename T>
void IPCCommunicationService<T>::create()
{

}

template <typename T>
void IPCCommunicationService<T>::destroy()
{
	m_queue.destroy();
}

template <typename T>
void IPCCommunicationService<T>::connect()
{

}

template <typename T>
void IPCCommunicationService<T>::disconnect()
{
}

template <typename T>
void IPCCommunicationService<T>::send(MessageId_t id,T data)
{
	m_queue.put(id, data );
}

template <typename T>
T IPCCommunicationService<T>::recv(MessageId_t id)
{
	return m_queue.get(id);
}

}
#endif /* COMMUNICATIONSERVICE_H_ */
